]> git.r.bdr.sh - rbdr/map/blobdiff - Map/Presentation/Base Components/MapRender/MapStages.swift
Map 3 first commit: files, groups and layout
[rbdr/map] / Map / Presentation / Base Components / MapRender / MapStages.swift
index 0fc8f486a7ec16e5ef49d469a0e992387576b786..fc3bfa196e1e3fe6ade821d4f4e81ae09809138c 100644 (file)
@@ -1,5 +1,5 @@
-import SwiftUI
 import Patterns
+import SwiftUI
 
 struct MapStages: View {
 
@@ -10,17 +10,29 @@ struct MapStages: View {
 
   var body: some View {
     ZStack(alignment: .topLeading) {
-      PatternView(design: .constant(.stitch), pixelSize: 1.0, foregroundColor: .map.stageForeground, backgroundColor: .map.stageBackground)
-        .frame(width: w(stages[0]), height: mapSize.height)
-      PatternView(design: .constant(.shingles), pixelSize: 1.0, foregroundColor: .map.stageForeground, backgroundColor: .map.stageBackground)
-        .offset(CGSize(width: w(stages[0]), height: 0))
-        .frame(width: w(stages[1]) - w(stages[0]), height: mapSize.height)
-      PatternView(design: .constant(.shadowGrid), pixelSize: 1.0, foregroundColor: .map.stageForeground, backgroundColor: .map.stageBackground)
-        .offset(CGSize(width: w(stages[1]), height: 0))
-        .frame(width: w(stages[2]) - w(stages[1]), height: mapSize.height)
-      PatternView(design: .constant(.wicker), pixelSize: 1.0, foregroundColor: .map.stageForeground, backgroundColor: .map.stageBackground)
-        .offset(CGSize(width: w(stages[2]), height: 0))
-        .frame(width: mapSize.width - w(stages[2]), height: mapSize.height)
+      PatternView(
+        design: .constant(.stitch), pixelSize: 1.0, foregroundColor: .map.stageForeground,
+        backgroundColor: .map.stageBackground
+      )
+      .frame(width: w(stages[0]), height: mapSize.height)
+      PatternView(
+        design: .constant(.shingles), pixelSize: 1.0, foregroundColor: .map.stageForeground,
+        backgroundColor: .map.stageBackground
+      )
+      .offset(CGSize(width: w(stages[0]), height: 0))
+      .frame(width: w(stages[1]) - w(stages[0]), height: mapSize.height)
+      PatternView(
+        design: .constant(.shadowGrid), pixelSize: 1.0, foregroundColor: .map.stageForeground,
+        backgroundColor: .map.stageBackground
+      )
+      .offset(CGSize(width: w(stages[1]), height: 0))
+      .frame(width: w(stages[2]) - w(stages[1]), height: mapSize.height)
+      PatternView(
+        design: .constant(.wicker), pixelSize: 1.0, foregroundColor: .map.stageForeground,
+        backgroundColor: .map.stageBackground
+      )
+      .offset(CGSize(width: w(stages[2]), height: 0))
+      .frame(width: mapSize.width - w(stages[2]), height: mapSize.height)
 
       Path { path in
         path.move(to: CGPoint(x: w(stages[0]), y: 0))
@@ -34,7 +46,8 @@ struct MapStages: View {
         path.closeSubpath()
         path.move(to: CGPoint(x: w(stages[0]), y: 0))
         path.closeSubpath()
-      }.strokedPath(StrokeStyle(lineWidth: lineWidth / 4, dash: [10.0, 18.0])).stroke(Color.map.axisColor)
+      }.strokedPath(StrokeStyle(lineWidth: lineWidth / 4, dash: [10.0, 18.0])).stroke(
+        Color.map.axisColor)
     }
   }
 
@@ -43,10 +56,8 @@ struct MapStages: View {
   }
 }
 
-struct MapStages_Previews: PreviewProvider {
-  static var previews: some View {
-    MapStages(
-      mapSize: CGSize(width: 200.0, height: 200.0), lineWidth: CGFloat(0.5),
-      stages: [25.0, 50.0, 75.0])
-  }
+#Preview {
+  MapStages(
+    mapSize: CGSize(width: 200.0, height: 200.0), lineWidth: CGFloat(0.5),
+    stages: [25.0, 50.0, 75.0])
 }